<script>
export default {
  name: 'DynRadio',
  model: {
    prop: 'value',
    event: 'change'
  },
  props: {
    value: {
      type: [String, Number], // 验证类型后续可以增加
      default: ''
    },
    item: {
      type: Object,
      default: () => ({})
    }
  },
  methods: {
    handlerRadio(value) {
      this.$emit('input', value)
      this.item.event && this.item.event(value)
    }
  },
  render: function(h) {
    return (
      this.item.render ? this.item.render()
      // 不执行?????
        : <el-radio-group value={this.value} on-input={this.handlerRadio.bind(this)}>
          <el-radio label={1}>按材料类别</el-radio>
          <el-radio label={2}>按材料编号</el-radio>
        </el-radio-group>
    )
  }
}
</script>

